package com.dongdong.controller;

import com.dongdong.em.Result;
import com.dongdong.model.TbAdmin;
import com.dongdong.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("admin")
@RefreshScope       //热更新
public class AdminController {

    @Autowired
    private AdminService adminService;

    @GetMapping("getadminByName")
    public Result getAdminByName(@RequestParam String username){
        TbAdmin admin=adminService.getAdminByName(username);
        return Result.OK().setData(admin);
    }
}
